package com.momo.hotel.service.impl;

import com.momo.hotel.dao.mapping.ext.TbNewsMapperExt;
import com.momo.hotel.dao.pojo.TbNews;
import com.momo.hotel.dao.pojo.ext.TbNewsExt;
import com.momo.hotel.service.NewsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class NewsServiceImpl implements NewsService {
    @Resource
    TbNewsMapperExt tbNewsMapperExt;
    /**
     * 添加新闻
     * @param tbNews
     * @return
     */
    @Override
    public Integer addNews(TbNews tbNews) {
        return tbNewsMapperExt.addNews(tbNews);
    }

    /**
     * 查询新闻
     * @return
     */
    @Override
    public List<TbNewsExt> selectNews() {
        return tbNewsMapperExt.selectNews();
    }

    /**
     * 新闻详情
     * @param id
     * @return
     */
    @Override
    public TbNewsExt newsDetail(Integer id) {
        return tbNewsMapperExt.newsDetail(id);
    }

    /**
     * 查询带用户名的新闻
     * @return
     */
    @Override
    public List<TbNewsExt> selectNewsLimit() {
        return tbNewsMapperExt.selectNewsLimit();
    }
}
